package utils

import (
	"ChdChat-Gin/initialize"
	"github.com/gomodule/redigo/redis"
)

func SaveByteArr(client string, msg []byte) error {
	// Using the HSET command to save JSON strings to the Hash field in Redis
	redisConn := initialize.RedisPool.Get()
	defer func(redisConn redis.Conn) {
		if err := redisConn.Close(); err != nil {
			panic(err)
		}
	}(redisConn)
	_, err := redisConn.Do("RPUSH", client, msg)
	return err
}
